package com.yami.shop.controller;

import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.service.impl.RongYunUserBanServiceImpl;
import com.yami.shop.vo.ban.GroupBanVo;
import com.yami.shop.vo.group.GroupIdVo;
import io.rong.models.response.ListGagGroupUserResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 群整体禁言
 */
@RestController
@RequestMapping("/account/im/group/ban")
@Schema(description = "app-钱包IM群组成员全部禁言")
public class RongYunUserBanController {

    @Autowired
    private RongYunUserBanServiceImpl groupBanService;

    @PostMapping("/group_ban_add")
    @Operation(summary =  "设置用户在加入的所有群组中都不能发送消息")
    public ServerResponseEntity<String> create(@RequestBody @Valid GroupBanVo groupVo) {
        return groupBanService.add(groupVo);
    }

    @GetMapping("/group_ban_getList")
    @Operation(summary =  "获取所有群组禁言用户列表", description = "获取所有群组禁言用户列表")
    public ServerResponseEntity<ListGagGroupUserResult> getList() {
        return groupBanService.getList();
    }


    @PostMapping("/group_ban_remove")
    @Operation(summary =  "移除用户在所有群组中的禁言设置", description = "移除用户在所有群组中的禁言设置")
    public ServerResponseEntity<String> userRefresh(@RequestBody List<GroupIdVo> groups) {
        return groupBanService.remove(groups);
    }

}
